<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>

<c:set var="ctx" value="${pageContext.request.contextPath}" />

<div id="main-content">
	<form>
		<lable><b>填写优惠券编号：</b></lable>
		<div>
			<input type="text" name="couponNo" style="width:300px;">
			<span id="no-conpon" style="color:red;display:none;">&nbsp *该优惠券不存在</span>
			<span id="unuse-conpon" style="color:red;display:none;">&nbsp *该优惠券未使用</span>
			<span id="used-conpon" style="color:green;display:none;">&nbsp *该优惠券已使用，可操作</span>
			<span id="obs-conpon" style="color:red;display:none;">&nbsp *该优惠券已作废</span>
			<span id="error" style="color:red;display:none;">&nbsp *查询优惠券出错</span>
				<span id="writeconpon" style="color:red;display:none;">&nbsp *请填写优惠券编号</span>
		</div>		
		<div id="couponinfo">
			
		</div>
		<div id="goods-use" style="display:none">
			<lable><b>填写备注信息：</b></lable>
			<label>物流公司：</label><input id="select-wuliu" name="trackwlgs" type="text" style="width:300px;">
			<label>物流单号：</label><input name="trackNum" type="text" style="width:300px;">
			<label>物流清单：</label><textarea class="text-area" name="trackDetail" type="text" style="width:60%;height:150px"></textarea>
			<label>其他 :</label><textarea class="text-area" type="text" name="trackElse" style="width:60%;height:150px"></textarea>
		</div>
		<div id="activity-use" style="display:none">
			<lable><b>填写备注信息：</b></lable>
			<label>消费方式：</label><input name="useType" type="text" style="width:300px;">
			<label>使用地点：</label><input name="usePlace" type="text" class="text-area">
			<label>其他 :</label><textarea class="text-area" type="text" name="useElse" style="width:60%;height:150px"></textarea>
		</div>
		<button  class="btn btn-primary addto-address" id="find" >查询</button>
		<button  class="btn btn-primary addto-address" id="use" style="display:none">使用</button>
		<button  class="btn btn-primary addto-address" id="save" style="display:none">保存</button>
		<button  class="btn btn-primary addto-address" id="cancel" style="display:none">取消</button>
	</form>
</div>
<script type="text/html" id="couponinfo-template">
<table>
	<tr>
		<td>编号：</td>
		<td><$=result.couponNo$></td>
	</tr>
	<tr>
		<td>状态：</td>
		<td>
		<$if(result.couponStatus == '0'){$>
			未使用<span id="unuse-conpon" style="color:red;">&nbsp *该优惠券未使用</span>
		<$}else if(result.couponStatus == '1'){$>
			已使用<span id="used-conpon" style="color:green;">&nbsp *该优惠券已使用，可操作</span>
		<$}else if(result.couponStatus == '2'){$>
			已作废<span id="obs-conpon" style="color:red;">&nbsp *该优惠券已作废</span>
		<$}$>
		</td>
	</tr>
	<tr>
		<td>类型：</td>
		<td>
		<$if(result.label == 'goods'){$>
			实物券
		<$}else if(result.label == 'activity'){$>
			虚拟券
		<$}else if(result.label == 'money'){$>
			现金券<span id="unuse-conpon" style="color:red;">&nbsp *该优惠券为现金券，不可操作</span>
		<$}$>
		</td>
	</tr>
	<tr>
		<td>所属用户：</td>
		<td><$=result.user.name$></td>
	</tr>
	<tr>
		<td>价值：</td>
		<td><$=result.couponValue$></td>
	</tr>
	<tr>
		<td>简介：</td>
		<td><$=result.couponExplain$></td>
	</tr>

</table>
</script>
<c:if test="${env == 'production' }">
	<script type="text/javascript">
		seajs.use("${ctx}/assets/js-dist/admin/coupon-use-page");
	</script>
</c:if>
<c:if test="${env != 'production' }">
	<script type="text/javascript">
		seajs.use("${ctx}/assets/js/admin/coupon-use-page");
	</script>
</c:if>